<!DOCTYPE html>
<html>
<head>
    <title>储物间导入</title>
<#include "../common/common.ftl"/>
</head>
<body style="overflow-y: hidden;">
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">储物间数据：</div>
        <div class="layui-card-body">
            <form class="layui-form" id="storageRoomArrayForm">
                <input type="hidden" name="azProjectId" value="${(azProject.id)!}"/>
                <textarea class="layui-textarea" cols="150" rows="13" name="storageRoomArray"
                          lay-verify="required" style="resize:none;background-color:  #FFFFE0;"></textarea>
                <button class="layui-btn layui-btn-fluid"
                        style="margin-top: 10px;" lay-submit="" lay-filter="submit">立即导入
                </button>
            </form>
        </div>
    </div>

    <div class="layui-card">
        <div class="layui-card-header">数据导入说明</div>
        <div class="layui-card-body" style="color: red;">
            1、请按照下方图片所示红色框线内数据粘贴到上方文本框内，并确认数据正确性；<br/>
            2、数据格式： 幢号、户号、所在层数、建筑面积、备注，每一列都不能为空；<br/>
            3、导入期间请耐心等待，勿进行其他操作。
            <img src="/images/storageRoomImport.png" style="max-width: 100%;"/>
        </div>
    </div>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['form'], function () {
        var $ = layui.jquery, form = layui.form, parentIndex = parent.layer.getFrameIndex(window.name);
        //监听提交
        form.on('submit(submit)', function (data) {
            $.ajax({
                url: 'importStorageRoom',
                type: 'post',
                data: $("#storageRoomArrayForm").serialize(),
                async: false,
                success: function (data) {
                    if (data.code == "0001") {
                        layer.alert(data.message, function (index) {
                            parent.layer.close(parentIndex);
                        })
                        parent.loadData();
                    } else {
                        layer.msg(data.message, {anim: 6, icon: 2, time: 3000});
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>